﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>


  <title>Performance</title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

  <link href="../css/default.css" rel="stylesheet" type="text/css">

  <link href="../css/print.css" rel="stylesheet" type="text/css" media="print">
</head>


<body>

<h1>脚本性能</h1>


<p>每个脚本在它被载入以及语法检查时都是半编译的。这样做除了会减少脚本消耗的内存外，也会极大地提高运行时的性能。</p>

<p>除了 <a href="../commands/SetBatchLines.htm">SetBatchLines</a>,根据脚本的内容，下列命令同样会影响到性能: <a href="../commands/SendMode.htm">SendMode</a>, <a href="../commands/SetKeyDelay.htm">SetKeyDelay</a>, <a href="../commands/SetMouseDelay.htm">SetMouseDelay</a>, <a href="../commands/SetWinDelay.htm">SetWinDelay</a>, <a href="../commands/SetControlDelay.htm">SetControlDelay</a> 
    和 <a href="../commands/SetDefaultMouseSpeed.htm">SetDefaultMouseSpeed</a>。</p>


<p>下面是优化过程的技术细节(半编译):</p>

<ul>

  <li>输入输出变量(当不含其它变量的引用时)以及 <a href="../commands/GroupAdd.htm">group</a> 
      名称被解析为内存地址。</li>

  <li><a href="../commands/Loop.htm">Loops</a>, <a href="../commands/Block.htm">blocks</a>, <a href="../commands/IfEqual.htm">IFs</a> 
      和 <a href="../commands/Else.htm">ELSEs</a> 会给出它们在脚本内相关的跳转点的内存地址。</li>

  <li>每个 <a href="../Hotkeys.htm">Hotkey</a>,<a href="../commands/Gosub.htm"> Gosub</a> 
      和 <a href="../commands/Goto.htm">Goto</a> 的终点被解析为一个内存地址，除非它是个变量。</li>

  <li>在一个跳转列表里，每个命令名称都被替换成一个地址。</li>

  <li>每一行都被预解析成一个参数列表。</li>

  <li>每个参数和&nbsp;<a href="../Variables.htm#Expressions">表达式</a> 都被预解析为一个&nbsp;<a href="../Variables.htm">变量</a> 
      和&nbsp;<a href="../Functions.htm">函数</a> 的列表(如果有的话)。</li>

  <li>每个变量或函数的引用都被解析为一个内存地址。</li>

</ul>



</body>
</html>
